//---------------------------------------------------------------------
//  This file is part of the Background Motion solution.
// 
//  Copyright (C) Mindscape (TM).  All rights reserved.
//  http://www.mindscape.co.nz
// 
//  THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//---------------------------------------------------------------------

using System;
using System.Collections.Generic;
using Mindscape.BackgroundMotion.Model;
using Mindscape.BackgroundMotion.Website.Controllers;
using Mindscape.BackgroundMotion.Website.Infrastructure;
using Mindscape.BackgroundMotion.Website.Views;

namespace Mindscape.BackgroundMotion.Website
{
  public partial class Moderate : PageBase<ModeratePresenter, IModerateView, IContributionController>, IModerateView
  {
    private IList<Contribution> _contributions;

    protected override void OnLoad(EventArgs e)
    {
      base.OnLoad(e);

      if (Request.QueryString["DeleteID"] != null)
      {
        Presenter.DeleteContent(int.Parse(Request.QueryString["DeleteID"]));
      }

      if (Request.QueryString["ApproveID"] != null)
      {
        Presenter.ApproveContent(int.Parse(Request.QueryString["ApproveID"]));
      }
    }

    /// <summary>
    /// A list of currently unmoderated contributions to be used with this view
    /// </summary>
    public IList<Contribution> UnmoderatedContributions
    {
      get { return _contributions; }
      set
      {
        _contributions = value;

        UnmoderatedContributionsDataBinder.DataBind(this);
      }
    }
  }
}